import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue';
import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  base: "/2303/",
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
      "~": path.resolve(__dirname, "./src/api")
    },
    extensions: ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json', ".vue"]
  },
  server: {
    port: 2303,
    open: true,
    proxy:{
      '/api': {
        target: 'http://118.178.238.19:3001',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
    }
  },
})
